# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=ydotool
pkgver=0.1.8
pkgrel=0
pkgdesc="Generic Linux command-line automation tool"
options="!check" # No tests
url="https://github.com/ReimuNotMoe/ydotool"
arch="all"
license="MIT"
makedepends="cmake uinputplus-dev libevdevplus-dev boost-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/ReimuNotMoe/ydotool/archive/v$pkgver.tar.gz
	ydotool.conf
	40-ydotool-uinput.rules
	no-static.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS .
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install

	install -Dm0644 "$srcdir"/ydotool.conf -t "$pkgdir"/usr/lib/modules-load.d
	install -Dm0644 "$srcdir"/40-ydotool-uinput.rules -t "$pkgdir"/usr/lib/udev/rules.d
}

sha512sums="90eb1db5e030ed6f402a88b0dc58804abe0ef45deb4ea22da44ef19b06bdb482732afb3275ef6ac586ccd455978c1212dff3646a6e11107ef980957a6b312b74  ydotool-0.1.8.tar.gz
a9b069ed121ffeee887e0583d8cb46035ecf1fa90a26a4ecb3aa11ff03178b2b08621f6676db6b2350f290694c04aabcf36f2ce3e0813a76dde9a33555edb112  ydotool.conf
34ae01f86275ff74f1306dee302deaef40bf7dae9ad69526601539daa45974578899d9af88ac4c3ba5908b749461ce68d7d124537042efe0d1538076989fda80  40-ydotool-uinput.rules
eb1279f869196273b9db1f9d089d98594eb4b83d1dac7545957406a87ffbb1a8817bb28f0dafb63e39dd3d992348a326a57419f815f657c9486898adf0e3e5fa  no-static.patch"
